package hn.cch.hadoop.wordcount;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

import java.util.Arrays;

public class YarnMain {


    public static void main(String[] args) {
        Configuration configuration = new Configuration();
        Tool tool = null;

        switch (args[0]) {
            case "wordcount":
                tool = new YarnTool();
                break;
            default:
                throw new RuntimeException("args[0] not match tool");
        }

        int run = 0;
        try {
            run = ToolRunner.run(configuration, tool, Arrays.copyOfRange(args, 1, args.length));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        System.exit(run);
    }
}
